package com.framework.plugin.xmlsql.tag;

import java.util.List;
import java.util.Map;

public class OtherwiseTag extends DefaultTag {
	
	private ChooseTag chooseTag;

	public ChooseTag getChooseTag() {
		return chooseTag;
	}

	public void setChooseTag(ChooseTag chooseTag) {
		this.chooseTag = chooseTag;
	}
	
	public OtherwiseTag(Map<String, Object> map) {
		super.setMap(map);
	}

	@Override
	public String createSql(String text) {
		List<Boolean> whens = chooseTag.getWhens();
		int count = 0;
		for(Boolean b:whens) {
			if(b)
				count++;
		}
		if(count==0)
			return text;
		else
			return "";
	}

	@Override
	public void prepare() {
		
	}

}
